package com.hzlj.position.locate.common.dto.reportAudio;


import cn.hutool.core.util.ObjectUtil;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fz.common.base.enums.db.ResultField;
import com.fz.common.dict.annotation.Dict;
import com.hzlj.position.locate.common.model.ReportAudio;
import com.hzlj.sqjz.jz.common.dto.common.JzCommonQueryResultDTO;
import lombok.Data;
import lombok.ToString;
import lombok.experimental.Accessors;

import java.util.Date;

import static com.fz.common.base.core.date.DateUtils.*;

/**
 * 主动音频上报(ReportAudio)查询结果返回DTO
 *
 * @author makejava
 * @date 2024-01-15 10:52:21
 */
@Data
@ToString
@Accessors(chain = true)
public class ReportAudioWithJzJbxxDTO extends JzCommonQueryResultDTO {
    /**
     * 主键
     */
    @ResultField(ReportAudio.class)
    private String id;
    /**
     * 所属天
     */
    @ResultField(ReportAudio.class)
    @JsonFormat(locale = LOCALE, timezone = TIME_ZONE, pattern = DATE_SHORT_FORMAT)
    private Date belongDay;
    /**
     * 人工上报状态,dict-REPORT_AUDIO_STATUS
     */
    @ResultField(ReportAudio.class)
    @Dict(value = "REPORT_AUDIO_STATUS")
    private String reportStatus;
    /**
     * 人工上报状态,dict-REPORT_AUDIO_STATUS(文本)
     */
    private String reportStatusText;
    /**
     * 上报时间
     */
    @ResultField(ReportAudio.class)
    private Date reportTime;
    /**
     * 上报地址
     */
    @ResultField(ReportAudio.class)
    private String reportAddress;
    /**
     * 上报的现场图片
     */
    @ResultField(ReportAudio.class)
    private String fileIds;
    /**
     * 音频时长（毫秒）
     */
    @ResultField(ReportAudio.class)
    private Integer audioDuration;
    /**
     * 音频文本
     */
    @ResultField(ReportAudio.class)
    private String audioText;
    /**
     * 是否已经处理,dict-HANDLE_STATUS
     */
    @Dict("HANDLE_STATUS")
    @ResultField(ReportAudio.class)
    private String handleStatus;
    /**
     * 是否已经处理,dict-HANDLE_STATUS(文本)
     */
    private String handleStatusText;
    /**
     * 异常处理上报状态,dict-REPORT_AUDIO_HANDLE_STATUS
     */
    @Dict("REPORT_AUDIO_HANDLE_STATUS")
    @ResultField(ReportAudio.class)
    private String handleReportStatus;
    /**
     * 处理状态,dict-REPORT_AUDIO_HANDLE_STATUS
     */
    private String handleReportStatusText;
    /**
     * 是否越界
     */
    @ResultField(ReportAudio.class)
    private Boolean crossBorder;
    /**
     * 额外参数,json-ReportAudioExtDTO
     */
    @ResultField(ReportAudio.class)
    private ReportAudioExtDTO ext;
    /**
     * 是否已读
     */
    @ResultField(ReportAudio.class)
    private Boolean read;
    /**
     * 已读时间
     */
    @ResultField(ReportAudio.class)
    private Date readTime;
    /**
     * 声纹核验状态,dict-REPORT_AUDIO_VOICE_PRINT_MATCH
     */
    @ResultField(ReportAudio.class)
    @Dict("REPORT_AUDIO_VOICE_PRINT_MATCH")
    private String voiceprintMatch;
    /**
     * 声纹核验状态,dict-REPORT_AUDIO_VOICE_PRINT_MATCH(文本)
     */
    private String voiceprintMatchText;
    /**
     * 异常处理声纹核验状态,dict-REPORT_AUDIO_HANDLE_VOICE_PRINT_MATCH
     */
    @ResultField(ReportAudio.class)
    @Dict("REPORT_AUDIO_HANDLE_VOICE_PRINT_MATCH")
    private String handleVoiceprintMatch;
    /**
     * 异常处理声纹核验状态,dict-REPORT_AUDIO_HANDLE_VOICE_PRINT_MATCH(文本)
     */
    private String handleVoiceprintMatchText;

    public String getCrossBorderText() {
        if (ObjectUtil.isEmpty(crossBorder)) {
            return "/";
        }
        return Boolean.TRUE.equals(crossBorder) ? "越界" : "正常";
    }

    public String getReadText() {
        return Boolean.TRUE.equals(read) ? "已读" : "未读";
    }
}
